package com.tjetc.controller;

import com.tjetc.common.JsonResult;
import com.tjetc.service.SpotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("spot")
public class SpotController {
    @Autowired
    SpotService spotService;
    @RequestMapping("all")
    public JsonResult selectall() {
        return spotService.getAll();
    }
    @RequestMapping("top/{length}")
    public JsonResult selecttop(@PathVariable("length") Long length) {
        return spotService.getTop(length);
    }
    @RequestMapping("class")
    public JsonResult selectclass() {
        return spotService.getBytagclazz();
    }
    @RequestMapping("detail/{id}")
    public JsonResult detail(@PathVariable("id") Long id) {
        return spotService.findSpotById(id);
    }
    @RequestMapping("city/{citycode}")
    public JsonResult selectct(@PathVariable("citycode") Long citycode) {
        return spotService.getSpotByCity(citycode);
    }



}
